#pragma once
#include "main.h"
#include <vector>

using std::ifstream;
using std::ofstream;

/**
* AUTHOR: MARCUS BELCHER
* VER: 1.5
* DATE: 9/10/2010
* CLASS: DataSystem.h
* Data system header file, initialises certain globals
* and needed methods for adaquet data loading and saving
*/

const static string ERROR_WRITE_FILE	= "ERROR: cannot write to file: "; 
const static string ERROR_READ_FILE		= "ERROR: cannot read/find file: ";

class DataSystem
{
public:
        DataSystem(): initialized(false){}
		~DataSystem(){
			DELETE(OUT_BUFFER);
			DELETE(BUFFER);
		}

		bool Initialized();
		bool readFile(std::string fileName);
		bool writeFile(std::string fileName, std::string fileData);

		void clearDataBuffers();
		void clearOutBuffer();
		void clearInBuffer();

		string getInputString()			{return BUFFER->str();}
		string getOutputBufferData()	{return OUT_BUFFER->str();}
		stringstream* getInputBuffer()	{return BUFFER;}
		stringstream* getOutputBuffer()	{return OUT_BUFFER;}
private:
		bool initialized;
		stringstream* BUFFER;
		stringstream* OUT_BUFFER;
};
